﻿@{
    Bundle("jquery_validate");
}

<script type="text/javascript">
    jQuery(document).ready(function(){
        jQuery('@ID("#form")').validate({
            rules: {
                supplierID: {
                    required: true,
                    digits: true
                },
                fileGroupID: {
                    required: true,
                    digits: true
                }
            }
        });
    });
</script>
<form id="@ID("form")" action="@Url.Action(Loc.Act("Update"))" method="post">
    <input type="hidden" name="flags" value="None" />
    <table>
        <tr>
            <td>
                <label>#</label>
            </td>
            <td>
                <input type="text" readonly name="id" value="@JDM.Int32(Model.EntityID)" />
            </td>
        </tr>
        <tr>
            <td>
                <label>&#10001;</label>
            </td>
            <td>
                <input type="text" readonly value="@Svc.DateTime((DateTime)JDM.DateTime(Model.CreatedOn))" />
            </td>
        </tr>
        <tr>
            <td>
                <label>&#10002;</label>
            </td>
            <td>
                <input type="text" readonly value="@Svc.DateTime((DateTime)JDM.DateTime(Model.UpdatedOn))" />
            </td>
        </tr>
        <tr>
            <td>
                <label>@T(Res.Name("CommentCount"))</label>
            </td>
            <td>
                <input type="text" readonly value="@JDM.Int32(Model.CommentCount)" />
            </td>
        </tr>
        <tr>
            <td>
                <label>@T(Res.Name("RatingCount"))</label>
            </td>
            <td>
                <input type="text" readonly value="@JDM.Int32(Model.RatingCount)" />
            </td>
        </tr>
        <tr>
            <td>
                <label>@T(Res.Name("RatingAverage"))</label>
            </td>
            <td>
                <input type="text" readonly value="@JDM.Byte(Model.RatingAverage)" />
            </td>
        </tr>
        <tr>
            <td>
                <a href="@Url.Action(Loc.Act("Edit").Ctrl("Supplier").Set(new
                {
                    id = JDM.Int32(Model.Supplier.EntityID)
                }))" class="ui-icon ui-icon-extlink"></a>
                <label>@T(Res.Name("Supplier"))</label>
            </td>
            <td>
                <input type="text" name="supplierID" value="@JDM.Int32(Model.Supplier.EntityID)" />
            </td>
        </tr>
        <tr>
            <td>
                @if(Model.FileGroup != null)
                {
                    <a href="@Url.Action(Loc.Act("Edit").Ctrl("Group").Area("FileSystem").Set(new
                    {
                        id = JDM.Int32(Model.FileGroup.EntityID)
                    }))" class="ui-icon ui-icon-extlink"></a>
                }
                <label>@T(Res.Name("FileGroup"))</label>
            </td>
            <td>
                <input type="text" name="fileGroupID" value="@(Model.FileGroup != null ? JDM.Int32(Model.FileGroup.EntityID) : 0)" />
            </td>
        </tr>
        <tr>
            <td>
                <label>@T(Res.In("API").Of("Enum").Of("CatalogItemFlags").Name("Active"))</label>
            </td>
            <td>
                <input type="checkbox" name="flags" value="Active" @(JDM.HasFlags(Model.Flags, "Active") ? "checked" : String.Empty) />
            </td>
        </tr>
        <tr>
            <td>
                <label>@T(Res.In("API").Of("Enum").Of("CatalogItemFlags").Name("RatingAllowed"))</label>
            </td>
            <td>
                <input type="checkbox" name="flags" value="RatingAllowed" @(JDM.HasFlags(Model.Flags, "RatingAllowed") ? "checked" : String.Empty) />
            </td>
        </tr>
        <tr>
            <td>
                <label>@T(Res.In("API").Of("Enum").Of("CatalogItemFlags").Name("AnonRatingAllowed"))</label>
            </td>
            <td>
                <input type="checkbox" name="flags" value="AnonRatingAllowed" @(JDM.HasFlags(Model.Flags, "AnonRatingAllowed") ? "checked" : String.Empty) />
            </td>
        </tr>
        <tr>
            <td>
                <label>@T(Res.In("API").Of("Enum").Of("CatalogItemFlags").Name("CommentAllowed"))</label>
            </td>
            <td>
                <input type="checkbox" name="flags" value="CommentAllowed" @(JDM.HasFlags(Model.Flags, "CommentAllowed") ? "checked" : String.Empty) />
            </td>
        </tr>
        <tr>
            <td>
                <label>@T(Res.In("API").Of("Enum").Of("CatalogItemFlags").Name("AnonCommentAllowed"))</label>
            </td>
            <td>
                <input type="checkbox" name="flags" value="AnonCommentAllowed" @(JDM.HasFlags(Model.Flags, "AnonCommentAllowed") ? "checked" : String.Empty) />
            </td>
        </tr>
        <tr>
            <td>
                <label>@T(Res.In("API").Of("Enum").Of("CatalogItemFlags").Name("Promoted"))</label>
            </td>
            <td>
                <input type="checkbox" name="flags" value="Promoted" @(JDM.HasFlags(Model.Flags, "Promoted") ? "checked" : String.Empty) />
            </td>
        </tr>
    </table>
    <ul class="bar toolbar">
        <li><button class="button" type="submit">@T(Res.In("Common").Of("Act").Name("Submit"))</button></li>
    </ul>
</form>